package com.yonyou.pmclouds.project.processor;

import com.yonyou.pmclouds.basecom.bp.processor.SingleProcessor;
import com.yonyou.pmclouds.basecom.exception.BusinessException;
import com.yonyou.pmclouds.project.entity.ProjectVO;
import com.yonyou.pmclouds.team.rmiimpl.TeamMaintainForProject;

/**
 * 项目状态变更同步到团队上的处理器
 * <br>
 * 由于最一开始只有结束态，所以名称之中带end
 */
public class EndUpdateTeamProcessor implements SingleProcessor<ProjectVO> {
    private TeamMaintainForProject teamMemberMaintain;

    public EndUpdateTeamProcessor(TeamMaintainForProject teamMemberMaintain) {
        this.teamMemberMaintain = teamMemberMaintain;
    }

    // 同步项目团队的项目状态
    @Override
    public void process(ProjectVO vo, ProjectVO orig) throws BusinessException {
        if (vo.getProjectState() != orig.getProjectState()) {
            teamMemberMaintain.updateProjectStateInTeam(vo);
        }
    }
}
